<?php /* Smarty version 2.6.20, created on 2016-07-21 16:07:50
         compiled from activity.htm */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'date_format', 'activity.htm', 109, false),array('modifier', 'in_array', 'activity.htm', 169, false),array('function', 'html_select_time', 'activity.htm', 110, false),)), $this); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>活动</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../module/inventory/css/admin/index.css" />
<script type="text/javascript" src="../script/jquery-1.4.4.min.js"></script>
<script language="javascript" src="../script/Calendar.js"></script>
<script type="text/javascript" src="../module/inventory/scripts/yui/yahoo-dom-event/yahoo-dom-event.js" ></script>
<script type="text/javascript" src="../module/inventory/scripts/yui/dragdrop/dragdrop-min.js" ></script>
<script type="text/javascript" src="../module/inventory/scripts/yui/calendar/calendar-min.js"></script>
<script type="text/javascript" src="../module/inventory/scripts/index.js"></script>
<script type="text/javascript" src="../script/jquery.validation.min.js"></script>
<script src="../script/my_lightbox.js" language="javascript"></script>

<script>
$(function(){
    $('.a').click(function () {
        var type = $("input[name='type']:checked").val();
        if(type==2){
            $('#goods_id').css('display','');
        }else{
            $('#goods_id').css('display','none');
        }
    })
	$('#form').validate({
		errorPlacement: function(error, element){
			element.next('.form-error').append(error);
		},      
		rules : {
			title:{
				required:true
			},
			stime:{
				required:true
			},
			etime:{
				required:true
			},
		},
		messages : {
			title:{
				required:'请填写标题',
			},
			etime:{
				//required:'请填写开始时间',
			},
			stime:{
				//required:'请填写结束时间',
			}
		}
	});
	$('#type').change(function(){
		var s=$(this).val();
		$('span[id^=type_]').hide()
		if(s!=0){
			$('#type_'+s).show();
		}
		
		
	})
});



</script>
</head>
<body>
	<div class="container">
        <div class="flow">
            <div class="itemtitle">
                <h3>活动</h3>
                <ul>
                    <li <?php if ($_GET['operation'] == ''): ?>class="current"<?php endif; ?>><a href="?m=activity&s=activity.php"><span>管理</span></a></li>
                    <li <?php if ($_GET['operation'] == 'add'): ?>class="current"<?php endif; ?>><a href="?m=activity&s=activity.php&operation=add"><span>添加</span></a></li>
                    <?php if ($_GET['operation'] == 'edit'): ?>
                    <li class="current"><a href="#"><span>修改</span></a></li>
                    <?php endif; ?>
                </ul>
            </div>
        </div>
        <div class="h35"></div>  
        <?php if ($_GET['operation'] == 'add' || $_GET['operation'] == 'edit'): ?>
            <form name="form" id="form" method="post">
            <input name="id" type="hidden" id="id" value="<?php echo $this->_tpl_vars['de']['id']; ?>
">
            <table class="table">
                <thead>
                    <tr>
                        <th class="partition" colspan="99">活动</th>
                    </tr>
                </thead>
                <tbody>
                <tr>
                    <td width="100">标题</td>
                    <td>
                    <input name="title" id="title" type="text" class="w350" value="<?php echo $this->_tpl_vars['de']['title']; ?>
"><div id="form-error" class="form-error"></div>
                    </td>
                </tr>
                
                <!--<tr>
                    <td>起止时间</td>
                    <td>
                    <script language="javascript">
                    var cdr = new Calendar("cdr");
                    document.write(cdr);
                    cdr.showMoreDay = true;
                    </script>
                    <input onFocus="cdr.show(this);" class="ltext" type="text" name="stime" id="stime" value="<?php echo ((is_array($_tmp=$this->_tpl_vars['de']['start_time'])) ? $this->_run_mod_handler('date_format', true, $_tmp) : smarty_modifier_date_format($_tmp)); ?>
"> 
                    <?php echo smarty_function_html_select_time(array('use_24_hours' => true,'display_seconds' => false,'prefix' => 'start','time' => $this->_tpl_vars['de']['start_time']), $this);?>

                    - 
                    <input onFocus="cdr.show(this);" class="rtext" type="text" name="etime" id="etime" value="<?php echo ((is_array($_tmp=$this->_tpl_vars['de']['end_time'])) ? $this->_run_mod_handler('date_format', true, $_tmp) : smarty_modifier_date_format($_tmp)); ?>
">
                    <?php echo smarty_function_html_select_time(array('use_24_hours' => true,'display_seconds' => false,'prefix' => 'end','time' => $this->_tpl_vars['de']['end_time']), $this);?>

                    <div id="form-error" class="form-error"></div>
                    </td>
                </tr>-->
                <tr style="display:none;">
                    <td width="100">折扣</td>
                    <td>
                    <input name="discount" id="discount" type="text"  value="<?php echo $this->_tpl_vars['de']['discount']; ?>
">

                    <a href="#" title="直接填入折扣率，如7折直接输入0.7"><img border="0" src="../image/admin/Help Circle.jpg" style="vertical-align:middle;"></a>
                    
                    </td>
                </tr>



                <!-- <tr>
                    <td>关联分类</td>
                    <td>
                <select class="ws350" name='catid' id="catid" >
                 <!--  <option value='-1'>手选单品</option>-->
                    	<!--<option value='0' <?php if ($this->_tpl_vars['de']['catid'] == 0): ?>selected="selected" <?php endif; ?>>全部分类</option>
                        <?php $_from = $this->_tpl_vars['de']['cat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
             			<option <?php if ($this->_tpl_vars['de']['catid'] == $this->_tpl_vars['list']['catid']): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['list']['catid']; ?>
"><?php echo $this->_tpl_vars['list']['cat']; ?>
</option>
             			<?php $_from = $this->_tpl_vars['list']['scat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['slist']):
?>
                            <option <?php if ($this->_tpl_vars['de']['catid'] == $this->_tpl_vars['slist']['catid']): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['slist']['catid']; ?>
">|__<?php echo $this->_tpl_vars['slist']['cat']; ?>
</option>
                            	    
                                    <?php $_from = $this->_tpl_vars['slist']['scat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['lists']):
?>
                                    <option <?php if ($this->_tpl_vars['de']['catid'] == $this->_tpl_vars['lists']['catid']): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['lists']['catid']; ?>
">|____<?php echo $this->_tpl_vars['lists']['cat']; ?>
</option>
                            		<?php endforeach; endif; unset($_from); ?> 
                                    
                            <?php endforeach; endif; unset($_from); ?> 
             			<?php endforeach; endif; unset($_from); ?>
            		</select> 
            		<a href="#" title="关联分类后整个分类的商品全部参加促销活动，如果选择全部分类，为全站活动，如果自选单品则可以在列表页选择参加活动的商品"><img border="0" src="../image/admin/Help Circle.jpg" style="vertical-align:middle;"></a>
            		   
                 </td>
                </tr>
                -->
                <!--<tr>
                    <td>关联品牌</td>
                    <td>
                    <input type="hidden" name="brandid" class="brandid" value="<?php echo $this->_tpl_vars['de']['brandid']; ?>
"/>
                    <input type='text' name='brand' class='brands' value="<?php echo $this->_tpl_vars['de']['brandname']; ?>
" placeholder='输入搜索词' autocomplete="off"/>
            		<ul class="brandlist" style="display:none;position:absolute;background-color:#fff;border: 1px solid rgb(207, 201, 201);width: 139px;">
        			</ul>
            		   
                 </td>
                </tr>
                <tr>
        <td>关联标签</td>
        <td>
        
        <select class="w200" name='tags[]' multiple="multiple" size="10" style="height:auto;">
                        <?php $_from = $this->_tpl_vars['de']['all_tags']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
                        
             			<option <?php if ($this->_tpl_vars['list']['stags']): ?> disabled <?php endif; ?> <?php if (@ ((is_array($_tmp=$this->_tpl_vars['list']['id'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['de']['tags']) : in_array($_tmp, $this->_tpl_vars['de']['tags']))): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['list']['id']; ?>
"><?php echo $this->_tpl_vars['list']['tags']; ?>
</option>
                           
                            <?php $_from = $this->_tpl_vars['list']['stags']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['slist']):
?>
                            <option <?php if ($this->_tpl_vars['slist']['stags']): ?> disabled <?php endif; ?> <?php if (@ ((is_array($_tmp=$this->_tpl_vars['slist']['id'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['de']['tags']) : in_array($_tmp, $this->_tpl_vars['de']['tags']))): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['slist']['id']; ?>
">|__<?php echo $this->_tpl_vars['slist']['tags']; ?>
</option>
                            	    
                                    <?php $_from = $this->_tpl_vars['slist']['stags']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['sslist']):
?>
                                    <option <?php if ($this->_tpl_vars['sslist']['stags']): ?> disabled <?php endif; ?> <?php if (@ ((is_array($_tmp=$this->_tpl_vars['sslist']['id'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['de']['tags']) : in_array($_tmp, $this->_tpl_vars['de']['tags']))): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['sslist']['id']; ?>
">|____<?php echo $this->_tpl_vars['sslist']['tags']; ?>
</option>
                                    
                                    <?php $_from = $this->_tpl_vars['sslist']['stags']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['lists']):
?>
                                    <option <?php if (@ ((is_array($_tmp=$this->_tpl_vars['lists']['id'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['de']['tags']) : in_array($_tmp, $this->_tpl_vars['de']['tags']))): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['lists']['id']; ?>
">|______<?php echo $this->_tpl_vars['lists']['tags']; ?>
</option>
                            		<?php endforeach; endif; unset($_from); ?>
                            		<?php endforeach; endif; unset($_from); ?> 
                                    
                            <?php endforeach; endif; unset($_from); ?> 
                            
                        <?php endforeach; endif; unset($_from); ?> 
            		</select>
 按住 “CTRL” 多选
        </td>
    </tr>-->
                <tr>
                    <td>类型</td>
                    <td>
                        <label>多商品<input type="radio" name="type" class="a" <?php if ($this->_tpl_vars['de']['type'] == 1): ?>selected="selected"<?php endif; ?> value="1"/></label>
                        <label>单商品<input type="radio" name="type" class="a" <?php if ($this->_tpl_vars['de']['type'] == 2): ?>selected="selected"<?php endif; ?> value="2"/></label>
                    </td>
                </tr>
                <tr style="display: none;" id="goods_id">
                    <td>商品id</td>
                    <td><label><input type="text" name="goods_id" value=""/></label></td>
                </tr>
                <tr>
                    <td>活动描述</td>
                    <td>
                    	<script charset="utf-8" src="../lib/kindeditor/kindeditor-min.js"></script>
						
                    	<script>
						var editor;
						KindEditor.ready(function(K) {
							editor = K.create('textarea[name="desc"]', {
								resizeType : 1,
								allowPreviewEmoticons : false,
								allowImageUpload : false,
								langType :'<?php echo $this->_tpl_vars['config']['language']; ?>
',
							});
						});
						</script>
                        <textarea style="width:80%; height:300px" name="desc"><?php echo $this->_tpl_vars['de']['desc']; ?>
</textarea>
                    </td>
				</tr>
                <tr>
                    <td>活动图片</td>
                     <td>
                    <input name="pic" class="w350" type="text" id="pic" value="<?php echo $this->_tpl_vars['de']['pic']; ?>
" />
                    [<a href="javascript:uploadfile('上传图片','pic',600,290,'activity')">上传</a>] 
                    [<a href="javascript:preview('pic');">预览</a>]
                    [<a onclick="javascript:$('#pic').val('');" href="#">删除</a>] <span class="bz"></span>
                    </td>
                </tr>
                
                <tr>
                    <td>展示状态</td>
                    <td>
                    <input type="radio" name="status" value="1" id="open" <?php if ($this->_tpl_vars['de']['status'] == 1): ?>checked="checked"<?php endif; ?>/><label for="open">开启</label>
                     <input type="radio" name="status" value="2" id="open" <?php if ($this->_tpl_vars['de']['status'] == 2): ?>checked="checked"<?php endif; ?>/><label for="open">推荐</label>
                    <input type="radio" name="status" value="0" id="close" <?php if ($this->_tpl_vars['de']['status'] == 0): ?>checked="checked"<?php endif; ?>/><label for="close">关闭</label>
                    </td>
                </tr>
                
                <tr>
                    <td>&nbsp;</td>
                    <td>
                    <input class="submit" type="submit" value="提交">
                    <input name="act" type="hidden" id="action" value="<?php if (! $_GET['editid']): ?>save<?php else: ?>edit<?php endif; ?>">
                    </td>
                </tr>
                </tbody>
            </table>
            </form>
            <script>
            
            /**通过分类关联品牌
            $('#catid').change(function(){
            	var $$=$(this);
            	if($$.val()==-1){
            		//$('#brandid').html("<option value='-1'>手选单品</option>");
            		return ;
            	}
            	else{
            		
            		<?php if ($this->_tpl_vars['de']['brandid'] && $this->_tpl_vars['de']['catid']): ?>
                    
                		var sbrand ='&sbrand=<?php echo $this->_tpl_vars['de']['brandid']; ?>
';
                    <?php else: ?>
                    
                    var sbrand ='';
                    <?php endif; ?>
            		
            		$.get('<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=activity&s=activity.php&operation=getbrand&catid='+$$.val()+sbrand,function(data){
                	//alert	(data);
                	
            			//$('#brandid').html("<option value='-1'>手选单品</option>"+data);
            			
            			$('#brandid').html(""+data);

            		});
            	}
            })
            **/
            
            
            //<?php if ($this->_tpl_vars['de']['brandid'] && $this->_tpl_vars['de']['catid']): ?>
            
            //$('#catid').change();
            
            //<?php endif; ?>
            
            
            $.each($('[stock]'),function(){
            	//alert($(this).attr('stock'));
            	var $stock=$(this);
            	
            	$.get('<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=product&s=inventory_api.php&stock='+$(this).attr('stock'),function(data){
            		$stock.html(data);
            	});

            	
            });
            $('#related_button').bind('click',function(){
            	window.parent.iframe_form("related","选择赠送产品",'<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=product&s=products_list.php&type=related', 800, 505);
            	return false;
            	});

            var rowtypedata = [
                              	[
                              		[1, '', 'al'], 
                              		[1, ''], 
                              		[1, ''], 
                              		[1, ''], 
                              		[1, ''],
                              		[1, ''],
                              		[1, '<div><a href="javascript:;" class="deleterow" onClick="deleterow(this,{1})">删除</a></div>']
                              	
                              	]
                              ];
                              var addrowdirect = 0;
                              var addrowkey = 0;
            function addrow(name, type) {
            	
            	$('#'+name+'_tr').show();
            	var obj=$('#'+name+'_button')[0];	
            	var table = obj.parentNode.parentNode.parentNode.parentNode;
            	var iframe=window.parent.document.getElementById("iframe_"+name).contentWindow;
            	var tab=iframe.document.getElementById(name+"_table");
            	var checkbox= $(tab).find("input[class='checkitem']:checked");
            	var typedata = rowtypedata[type];
            	$.each(checkbox,function(i){
            		var value1=$("#hidden_"+name).val();
            		var value2=this.value
            		if(value1.indexOf(','+value2+',') <= 0 )
            		{
            			$("#hidden_"+name).val(value1+value2+',');	
            			var tr=$(this).parent().parent();
            			if(!addrowdirect) {
            				var row = table.insertRow(obj.parentNode.parentNode.rowIndex);
            			} else {
            				var row = table.insertRow(obj.parentNode.parentNode.rowIndex + 1);
            			}
            			for(var i = 0; i <= typedata.length - 1; i++) {
            				if(i<=6)
            				{
            					var cell = row.insertCell(i);
            					if(i==6)
            					{
            						var tmp = typedata[i][1];
            					}
            					else
            					{
            						var tmp = tr.find('td')[i+1].innerHTML;
            					}
            					if(i==0){
            						cell.className = typedata[i][2];
            					}
            					tmp = tmp.replace(/\{(n)\}/g, function($1) {return addrowkey;});
            					tmp = tmp.replace(/\{(\d+)\}/g, function($1, $2) { return value2+',\''+name+'\''; });
            					cell.innerHTML = tmp;
            				}
            			}
            			addrowkey ++;
            			addrowdirect =0;
            		}
            	});
            }
            function deleterow(obj,id,name) {
            	var table = obj.parentNode.parentNode.parentNode.parentNode.parentNode;
            	var tr = obj.parentNode.parentNode.parentNode;
            	var value=$("#hidden_"+name).val();

            	var pattern = ','+id+',';
            	str = value.replace(new RegExp(pattern), ",");
            	$("#hidden_"+name).val(str);
            	table.deleteRow(tr.rowIndex);
            }
            
            </script>
        <?php else: ?>
		<script type="text/javascript">
        $(function(){
            /* 全选 */
             $('.checkall').click(function(){
                var _self = this;
                $('.checkitem').each(function(){
                    if (!this.disabled)
                    {
                        $(this).attr('checked', _self.checked);
                    }
                });
                $('.checkall').attr('checked', this.checked);
            });	 
        });
        </script>
        <form action="" method="get">
    <input type="hidden" name="m" value="activity">
    <input type="hidden" name="s" value="activity.php">
    <table class="select_table">
        <tbody>
            <tr>
                <td width="50">活动ID:</td>
                <td width="20">
                    <input id="activity_id" class="w50" name="activity_id" type="text" value="<?php echo $_GET['activity_id']; ?>
" />
                </td>
                <!--<td width="60">活动时间:</td>
                <td class="yui-skin-sam" width="200">
                	<input id="sdate" name="sdate" type="text" size="12" value="<?php echo $_GET['sdate']; ?>
" onfocus="lockinput(this)" />
                	<input id="edate" name="edate" type="text" size="12" value="<?php echo $_GET['edate']; ?>
" onfocus="lockinput(this)" />
            		<div id="calContainer" style="display:none; position:absolute;"></div>
            	</td>
                
               <td width="60">是否开始：</td>
                
                <td width="80">
                    <select name="is_start" id="is_start">
                        <option value="">全部</option>
                        <option value="1" <?php if ('1' === $_GET['is_start']): ?>selected="selected"<?php endif; ?>>正在特卖</option>
                        <option value="2" <?php if ('2' === $_GET['is_start']): ?>selected="selected"<?php endif; ?>>即将特卖</option>
                        <option value="-1" <?php if ("-1" == $_GET['is_start']): ?>selected="selected"<?php endif; ?>>已结束</option>
                    </select>
                </td>
                
                <td width="70">产品分类:</td>
                <td width="100">
                 <select class="ws350" name='cat'  id="cat">
                    	<option value='0'>全部分类</option>
                        <?php $_from = $this->_tpl_vars['de']['cat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
                        
             			<option <?php if ($this->_tpl_vars['re']['cid'] == $this->_tpl_vars['list']['catid'] || $_GET['cat'] == $this->_tpl_vars['list']['catid']): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['list']['catid']; ?>
"><?php echo $this->_tpl_vars['list']['cat']; ?>
</option>
                           
                            <?php $_from = $this->_tpl_vars['list']['scat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['slist']):
?>
                            <option <?php if ($this->_tpl_vars['re']['cid'] == $this->_tpl_vars['slist']['catid'] || $_GET['cat'] == $this->_tpl_vars['slist']['catid']): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['slist']['catid']; ?>
">|__<?php echo $this->_tpl_vars['slist']['cat']; ?>
</option>
                            	    
                                    <?php $_from = $this->_tpl_vars['slist']['scat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['lists']):
?>
                                    <option <?php if ($this->_tpl_vars['re']['cid'] == $this->_tpl_vars['lists']['catid'] || $_GET['cat'] == $this->_tpl_vars['lists']['catid']): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['lists']['catid']; ?>
">|____<?php echo $this->_tpl_vars['lists']['cat']; ?>
</option>
                            		<?php endforeach; endif; unset($_from); ?> 
                                    
                            <?php endforeach; endif; unset($_from); ?> 
                            
                        <?php endforeach; endif; unset($_from); ?> 
            		</select>
                </td>
                <td width="60">品牌：</td>
                <td>
               		<input type="hidden" name="brandid" class="brandid" value="<?php echo $_GET['brandid']; ?>
"/>
                    <input style="width:150px;" type='text' name='brand' class='brands' value="<?php echo $_GET['brand']; ?>
" placeholder='输入搜索词' autocomplete="off"/>
            		<ul class="brandlist" style="display:none;position:absolute;background-color:#fff;border: 1px solid rgb(207, 201, 201);width: 150px;">
        			</ul>
                </td>
                <td width="60">标签：</td>
                <td>
                	<select name="tags">
            			<option value="">选择标签</option>
                		<?php $_from = $this->_tpl_vars['de']['all_tags']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
                        
             				<option <?php if (@ ((is_array($_tmp=$this->_tpl_vars['list']['id'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['de']['tags']) : in_array($_tmp, $this->_tpl_vars['de']['tags']))): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['list']['id']; ?>
"><?php echo $this->_tpl_vars['list']['tags']; ?>
</option>
                           
                            <?php $_from = $this->_tpl_vars['list']['stags']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['slist']):
?>
                            	<option  <?php if (@ ((is_array($_tmp=$this->_tpl_vars['slist']['id'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['de']['tags']) : in_array($_tmp, $this->_tpl_vars['de']['tags']))): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['slist']['id']; ?>
">|__<?php echo $this->_tpl_vars['slist']['tags']; ?>
</option>
                            	    
                                <?php $_from = $this->_tpl_vars['slist']['stags']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['sslist']):
?>
                                <option <?php if (@ ((is_array($_tmp=$this->_tpl_vars['sslist']['id'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['de']['tags']) : in_array($_tmp, $this->_tpl_vars['de']['tags']))): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['sslist']['id']; ?>
">|____<?php echo $this->_tpl_vars['sslist']['tags']; ?>
</option>
                                    
	                                <?php $_from = $this->_tpl_vars['sslist']['stags']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['lists']):
?>
	                                	<option <?php if (@ ((is_array($_tmp=$this->_tpl_vars['lists']['id'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['de']['tags']) : in_array($_tmp, $this->_tpl_vars['de']['tags']))): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['lists']['id']; ?>
">|______<?php echo $this->_tpl_vars['lists']['tags']; ?>
</option>
	                           		<?php endforeach; endif; unset($_from); ?>
                           		<?php endforeach; endif; unset($_from); ?> 
                                    
                            <?php endforeach; endif; unset($_from); ?> 
                            
                        <?php endforeach; endif; unset($_from); ?> 
            		</select>
       			</td>-->

                <td width="60">状态：</td> 
                
                <td width="80">
                	<select name="statu" id="statu">
                		<option value="">全部</option>
                		<option value="1" <?php if ('1' === $_GET['statu']): ?>selected="selected"<?php endif; ?>>开启</option>
                		<option value="2" <?php if ('2' === $_GET['statu']): ?>selected="selected"<?php endif; ?>>推荐</option>
                		<option value="0" <?php if ('0' == $_GET['statu']): ?>selected="selected"<?php endif; ?>>关闭</option>
                	</select>
                </td>
                <td><input type="image" src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/image/admin/search.gif" /></td>
            </tr>
            
        </tbody>
    </table>
    </form>
        <form action="" method="post">
        <table class="table">
        	<thead>
                <tr>
                    <th class="partition" colspan="99">活动列表</th>
                </tr>
            </thead>
            <tbody>
                <tr class="header">
                    <th width="30"></th>
                    <th width="70">显示顺序</th>
                    <th width="50">活动ID</th>
                    <th width="200">标题</th>
                    <th width="60">类型</th>
                    <!--<th width="150">起止时间</th>-->
                    <!-- <th width="60">申请产品</th> -->
                    
                   <!-- <th width="170">分类</th>
                    <th width="170">品牌</th>
                    <th width="160">标签</th>-->
                    <th width="60">状态</th>
                    
                    <th width="100">操作</th>
                </tr>
                <?php $_from = $this->_tpl_vars['de']['list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
                <tr>
                    <td><input type="checkbox" value="<?php echo $this->_tpl_vars['list']['id']; ?>
" class="checkitem" name="chk[]"></td>
                    <td><input type="text" class="w50" maxlength="3" name="displayorder[<?php echo $this->_tpl_vars['list']['id']; ?>
]" value="<?php echo $this->_tpl_vars['list']['displayorder']; ?>
" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeyup="value=value.replace(/[^\d]/g,'')" /></td>
                    <td><?php echo $this->_tpl_vars['list']['id']; ?>
</td>
                    <td <?php if ($this->_tpl_vars['list']['pic'] != ''): ?>onmouseover="javascript:showOriginImg('<?php echo $this->_tpl_vars['list']['pic']; ?>
');" onmouseout="javascript:hideOriginImg();"<?php endif; ?>><?php echo $this->_tpl_vars['list']['title']; ?>
</td>
                    <!--<td><?php echo ((is_array($_tmp=$this->_tpl_vars['list']['start_time'])) ? $this->_run_mod_handler('date_format', true, $_tmp, "%Y-%m-%d %H:%M") : smarty_modifier_date_format($_tmp, "%Y-%m-%d %H:%M")); ?>
 <br/> <?php echo ((is_array($_tmp=$this->_tpl_vars['list']['end_time'])) ? $this->_run_mod_handler('date_format', true, $_tmp, "%Y-%m-%d %H:%M") : smarty_modifier_date_format($_tmp, "%Y-%m-%d %H:%M")); ?>
</td>
                    <!-- <td>&nbsp;<?php if ($this->_tpl_vars['list']['catid'] == -1): ?><?php echo $this->_tpl_vars['list']['num']; ?>
<?php else: ?>-<?php endif; ?></td> -->
                    <!--<td>&nbsp;<?php if ($this->_tpl_vars['list']['catid'] == 0): ?>全分类<?php elseif ($this->_tpl_vars['list']['catid'] == -1): ?>单品<?php else: ?><?php echo $this->_tpl_vars['list']['cat']; ?>
<?php endif; ?></td>
                    <td><?php echo $this->_tpl_vars['list']['brand']; ?>
</td>
                      <td><?php echo $this->_tpl_vars['list']['tags']; ?>
</td>-->
                    <td><?php if ($this->_tpl_vars['list']['type'] == 1): ?>多商品<?php else: ?>单商品<?php endif; ?></td>
                    <td><?php if ($this->_tpl_vars['list']['status'] == 1): ?>开启<?php elseif ($this->_tpl_vars['list']['status'] == 2): ?>推荐<?php else: ?>关闭<?php endif; ?></td>
                 
                    <td>
                    <a href="?m=activity&s=activity.php&operation=edit&editid=<?php echo $this->_tpl_vars['list']['id']; ?>
<?php echo $this->_tpl_vars['cond']; ?>
"><?php echo $this->_tpl_vars['editimg']; ?>
</a> 
                    <!-- <a onclick="return confirm('确定删除吗');" href="?m=activity&s=activity.php&delid=<?php echo $this->_tpl_vars['list']['id']; ?>
"><?php echo $this->_tpl_vars['delimg']; ?>
</a>--> 
                    <?php if ($this->_tpl_vars['list']['type'] == 1): ?>
                        <a href='?m=activity&s=activity_product_list.php&editid=<?php echo $this->_tpl_vars['list']['id']; ?>
<?php echo $this->_tpl_vars['cond']; ?>
'><?php echo $this->_tpl_vars['setimg']; ?>
</a>
                    <?php endif; ?>
                    </td>
                </tr>
                <?php endforeach; else: ?>
                <tr>
                    <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
                </tr>
                <?php endif; unset($_from); ?>
            </tbody>
            <tfoot>
                <tr>
                	<td colspan="99">
                        <input type="checkbox" class="checkall" id="del">
                        <input type="hidden" name="act" value="op" />
                        <input type="submit" value="提交" />
                    	<div class="page"><?php echo $this->_tpl_vars['de']['page']; ?>
</div>
                    </td>
                </tr>
            </tfoot>
        </table>
        </form>
        <?php endif; ?>
    </div>
    <div id="actImgDetail" align="center" style="position:fixed;top:120px;left:40%;display:none;"><img width="560" src="" onerror="this.src='../image/admin/sns_img_fail_min.jpg'" /></div>
</body>
<script>
$(function(){
	//默认待选品牌
	$('.brands').bind('click',function(e){
			$.get('<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=activity&s=activity.php&operation=getbrand&brandname=',function(data){
				$('.brandlist').show();
				$('.brandlist').html(""+data);
			});
	});
	//直接搜品牌
	$('.brands').bind('input',function(e){
		var value=$(this).val();
		if(value==''){
			$('.brandlist').hide();
			return ;
		}
		else{
			$.get('<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=activity&s=activity.php&operation=getbrand&brandname='+value,function(data){
				$('.brandlist').show();
				$('.brandlist').html(""+data);
			});
		}
	});
	$('body').bind('click',function(e){
		$('.brandlist').hide();
	});
	$('.brandlist').delegate('li','click',function(){
		var _this=$(this);
		var brandName=_this.text();
			var brandId=_this.attr('bid');
			$('.brands').val(brandName);
			$('.brandid').val(brandId);
			$('.brandlist').hide();
	});
	
	
});
//展示分享图片原图
function showOriginImg(src){
    var actImgDetail = $("#actImgDetail");
    actImgDetail.find('img').attr('src',src+"/560"); 
    actImgDetail.show();
}
//隐藏分享图片原图
function hideOriginImg(){
    $("#actImgDetail").hide();
}
</script>
</html>